<template>
  <el-input-number
    clearable
    :min="min"
    :max="max"
    v-model="state"
    :disabled="disabled"
    :controls="controls"
    :precision="precision"
    :placeholder="placeholder"
    class="width_100 height_auto"
  />
</template>

<script setup lang="ts">
  import { toRef } from 'vue'

  /**
   * @props
   */

  const props = defineProps({
    // 值
    value: {
      type: String,
      default: '',
    },
    // 最小值
    min: {
      type: Number,
      default: 0,
    },
    // 最大值
    max: {
      type: Number,
      default: 10000 * 10000,
    },
    // 是否使用控制按钮
    controls: {
      type: Boolean,
      default: false,
    },
    // 是否禁用状态
    disabled: {
      type: Boolean,
      default: false,
    },
    // 计数器步长
    step: {
      type: Number,
      default: 0.01,
    },
    placeholder: {
      type: String,
      default: '请输入',
    },
    // 保留几位小数
    precision: {
      type: Number,
      default: 2,
    },
  })

  const state: any = toRef(props.value)
</script>

<style scoped></style>
